package com.dky.satell.controller;

import com.dky.satell.dto.ResultDto;
import com.dky.satell.entity.Dictionary;
import com.dky.satell.service.DictionaryService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName DictionaryController
 * @Description
 * @Author fangyuan
 * @Date 2021/5/28 10:41
 * @Version 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/gather/dictionary")
public class DictionaryController {

    @Autowired
    private DictionaryService dictionaryService;

    @GetMapping(value = "/getByKey/{key}")
    @ApiOperation(value="根据key获取字典值")
    public ResultDto getByKey(@PathVariable("key") String key){
        log.info("begin to /dictionary/getByKey/{}", key);
        Dictionary dictionary = dictionaryService.getByKey(key);
        log.info("end to /dictionary/getByKey/{}", key);
        return ResultDto.success("", dictionary);
    }


}
